package Demo2;
//默认初始化
public class Student {
    public String name;
    public int age;
    private int ID;
    public static String classRoom;
    //实例代码块
    {
        this.name = "zhangsan";
        this.age = 18;
        this.ID = 12345;
    }

    //静态代码块
    static {
        classRoom = "113";
    }

//    public Student(String name, int age, int ID) {
//        this.name = name;
//        this.age = age;
//        this.ID = ID;
//    }
    //默认初始化赋值
//    public Student(){
//        this("zhangsan",18,12345);
//    }
//
//    //公用同一初始化逻辑
//    public Student(String name){
//        this(name,18,12345);
//    }


    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", ID=" + ID +
                '}';
    }
}
